﻿//----------------------------------------------------------------------
// <copyright file="FormInputDropOrders.cs" company="O-RID">
// Copyright (c)2010 O-RID Co.,Ltd.
// </copyright>
// <author>lidawei</author>
// <summary> 
// 作成日： 09/25/2010
// </summary>
//-----------------------------------------------------------------------

using System.Collections.Generic;

namespace Orid.Management.Statistics.Tools.Decomposition.UI
{
    using System;
    using System.Windows.Forms;

    /// <summary>
    /// FormInputDropOrders class
    /// </summary>
    public partial class FormInputOrders : FormChildBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="FormInputOrders"/> class.
        /// </summary>
        public FormInputOrders()
        {
            InitializeComponent();
            this.buttonOK.DialogResult = DialogResult.OK;
            this.buttonOK.Click += new EventHandler(ButtonOK_Click);
        }

        /// <summary>
        /// Handles the Click event of the ButtonOK control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void ButtonOK_Click(object sender, EventArgs e)
        {
            if ( Logic.SearchDecompositionConditions.GetInstance().Orders == null)
            {
                Logic.SearchDecompositionConditions.GetInstance().Orders = new List<Guid>();
            }
            else
            {
                 Logic.SearchDecompositionConditions.GetInstance().Orders.Clear();

            }
           
            foreach (string item in textBoxOrders.Lines)
	        {
                try
                {
                    Logic.SearchDecompositionConditions.GetInstance().Orders.Add(new Guid(item));
                }
                catch
                {
                    continue;
                }
	        }
        } 
    }
}
